package mosquito.g7;

import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;

import mosquito.sim.Collector;
import mosquito.sim.Light;
import mosquito.sim.Player;

public class G7HardcodedBlankPlayerWith3Lights extends Player {

    private Board board;
    LinkedList<Point2D> previouslyPlaceLights;
    
    @Override
    public String getName()
    {
        return "G7HardcodedBlankPlayerWith3Lights";
    }

    @Override
    public void startNewGame(Set<Line2D> walls, int NumLights)
    {
        previouslyPlaceLights = new LinkedList<Point2D>();

        if(board == null)
            board = new Board(walls);

    }

    @Override
    public Set<Light> getLights()
    {
        HashSet<Light> ret = new HashSet<Light>();
        
        Point2D.Double collectorPoint = board.getFurthestPointAwayFromLinesAndEdgeBoundaries();
        previouslyPlaceLights.add(collectorPoint);
        ret.add(new Light(collectorPoint.getX(), collectorPoint.getY() + 1, 100, 100, 1)); //TODO: what if Y+1 is out of bounds?
        
        double X1 = collectorPoint.getX()+(StaticZap.RADIUS)*Math.cos(Math.toRadians(45));
        double Y1 = collectorPoint.getY()+1+(StaticZap.RADIUS)*Math.sin(Math.toRadians(45));
        double X2 = collectorPoint.getX()+(StaticZap.RADIUS)*Math.cos(Math.toRadians(225));
        double Y2 = collectorPoint.getY()+1+(StaticZap.RADIUS)*Math.sin(Math.toRadians(225));
        Light light2 = new Light(X1, Y1, 1.5*StaticZap.FLYING_RADIUS_TIME, StaticZap.FLYING_RADIUS_TIME, 1);
        Light light3 = new Light(X2, Y2, 1.5*StaticZap.FLYING_RADIUS_TIME, StaticZap.FLYING_RADIUS_TIME, 1);
        ret.add(light2);
        ret.add(light3);
        
        return ret;
    }

    @Override
    public Collector getCollector()
    {
        Collector c = new Collector(50, 50); //TODO
        return c;
    }

}
